package cn.casc.tools.er;

import java.util.*;

/**
 * @author max
 * @version 1.0.1
 * @className EntityNode
 * @description
 * @copyright Copyright (c) 2023
 * @company 天纲梦工厂
 * @datetime 2024/7/18 14:00
 **/

public class EntityNode {
    String id;
    String title;
    List<ColumnItem> columns = new ArrayList<>();
    Set<ColumnItem> referenced = new HashSet<>();
    public EntityNode(String id) {
        this.id = id;
    }

    public String getTable() {
        return this.columns.get(0).table;
    }
    @Override
    public String toString() {
        return this.id;
    }
}


class ColumnItem {
    String table;
    String schema;
    String column;
    String columnType;
    String columnKey;
    String columnComment;
    boolean isFK;
    List<EntityNode> maybe = new ArrayList<>();
    Map<String, EntityNode> typeToOther = new HashMap<>();
    public String getFullName() {
        return String.format("%s.%s", this.table, this.column);
    }
}

